//////////////////////////////////////////////////////////////////////////////
//                                                                          //
//     Filename: BJXMLTranslator.h                                          //
//  Create date: April 1, 2004                                              //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////
//                                                                          //
//  Description: This file describes the BJXMLTranslator class.  This class //
//                is a protocol translator that translates from the RTG     //
//                Black Jack protocol to XML and back.                      //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////
//       Copyright (c) 2004 - Realtime Gaming.  All rights reserved.        //
//////////////////////////////////////////////////////////////////////////////

#ifndef __BJ_XML_TRANSLATOR__
#define __BJ_XML_TRANSLATOR__

#include "XMLTranslator.h"

//////////////////////////////////////////////////////////////////////////////
// BJXMLTranslator Class
//////////////////////////////////////////////////////////////////////////////
class BJXMLTranslator : public XMLTranslator
{
public:
    BJXMLTranslator( Server* pServer, Connection* pParent );
    virtual ~BJXMLTranslator();

    // Public Interface
    virtual bool8  TranslateIncomingMessage( uint8* pGameInBuff,  uint32 nGameInBuffSize, uint8* pBuff, uint32 nOutBuffSize );
    virtual uint32 TranslateOutgoingMessage( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize, uint32 nTotalGameBytes );

protected:
	// Internal Helpers
	bool8 AddOptionBits   ( XMLDoc* pDoc, uint8 nBits );
	bool8 AddOptionBits   ( XMLDoc* pDoc, const String& sParentQuery, uint8 nBits );
	bool8 AddHandStructure( XMLDoc* pDoc, const String& sParentQuery, uint8* pBuff, uint8& nNumBytesUsed );
	bool8 AddGameState    ( XMLDoc* pDoc, uint8* pBuff );

	// Incoming
	bool8 TranslateInLogin    ( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );
	bool8 TranslateInDeal     ( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );
	bool8 TranslateInAction   ( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );
	bool8 TranslateInHit      ( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );
	bool8 TranslateInStand    ( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );
	bool8 TranslateInDouble   ( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );
	bool8 TranslateInSplit    ( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );
	bool8 TranslateInInsurance( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );
	bool8 TranslateInSurrender( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );
	/// [2013-07-09] Charles. Added for supporting 'Zappit Rackcard'.
	bool8 TranslateInZap( XMLDoc* pDoc, uint8* pGameInBuff,  uint32 nGameInBuffSize );

	// Outgoing
	bool8 TranslateOutLogin    ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutOptions  ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutError    ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutAction   ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutHit      ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutStand    ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutSurrender( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	/// [2013-07-09] Charles. Added for supporting 'Zappit Rackcard'.
	bool8 TranslateOutZap( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutDeal     ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutDouble   ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutSplit    ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutInsurance( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutPlayNext ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
	bool8 TranslateOutFinished ( uint8* pOutBuff, uint32 nOutBuffSize, uint8* pGameOutBuff, uint32 nGameOutBuffSize );
};

#endif //#ifndef __BJ_XML_TRANSLATOR__